# Maintainer: fauxpark <fauxpark@gmail.com>

_realname=mdloader
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=1.0.5
pkgrel=1
pkgdesc='Massdrop keyboard firmware loader (mingw-w64)'
arch=('any')
license=('GPL3')
url='https://github.com/Massdrop/mdloader'
source=(
    "https://github.com/Massdrop/mdloader/archive/${pkgver}.tar.gz"
    01-get-applet-path.patch
)
sha256sums=(
    '2b2e88e2d66165f2160a0673dcacd94dbcb4f96c855fc0b4923ae569cd8f9e34'
    'b39b810d65dc018291c96d82c7fda047519f4524a1a8b0ca6cceb3b749a177be'
)

prepare() {
    cd ${srcdir}/${_realname}-${pkgver}

    patch -p1 -i ../01-get-applet-path.patch
}

build() {
    cd ${srcdir}/${_realname}-${pkgver}

    make
}

package() {
    cd ${srcdir}/${_realname}-${pkgver}/build

    install -Dm755 mdloader.exe ${pkgdir}${MINGW_PREFIX}/bin/mdloader.exe
    install -Dm644 applet-*.bin -t ${pkgdir}${MINGW_PREFIX}/share/mdloader
}
